#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char n[100100];
int main()
{
	int k;
	while(scanf("%d %s",&k,n)!=EOF)
	{
		int ans = 0;
		int len = strlen(n);
		int sum = 0;
		for(int i = 0;i<len;i++)
		{
			sum = sum+(n[i]-'0');
		}
		if(sum>=k)
		{
			printf("0\n");
			continue;
		} 
		else
		{
			sort(n,n+len);
			for(int i = 0;i<len,sum<k;i++)
			{
				int t = '9'-n[i];
				if(t==0) 
				{
					printf("0\n");
					break;
				}
				else 
				{
					ans++;
					sum = sum + t;
				}
			}
		}
		printf("%d\n",ans);
	}

}
